import request from "@/utils/request";

// 厂内生产工单-表头
export function factoryProductionWorkOrder(params) {
  return request({
    url: "/factoryProductionWorkOrder",
    params,
  });
}

/**
 * @description: 根据工单单号获取工单详情
 * @param {*} params BillNO:工单单号
 * @return {*}
 */
export function getOrderDetail(params) {
  return request({
    url: "/order_detail",
    params,
  });
}

/**
 * @description: 根据工单单号获取工单的工艺信息
 * @param {*} params BillNO:工单单号
 * @return {*}
 */
export function getOrderGongYi(params) {
  return request({
    url: "/order_gongyi",
    params,
  });
}

/**
 * @description: 根据工单单号获取工单的领料详情
 * @param {*} params BillNO:工单单号
 * @return {*}
 */
export function getOrderLingliaoDetail(params) {
  return request({
    url: "/order_lingliao_detail",
    params,
  });
}

/**
 * @description: 根据工单单号获取工单的领料清单
 * @param {*} params BillNO:工单单号
 * @return {*}
 */
export function getOrderLingliao(params) {
  return request({
    url: "/order_lingliao",
    params,
  });
}

// 委外生产工单-表头
export function qutsourcingProductionWorkOrder(params) {
  return request({
    url: "/qutsourcingProductionWorkOrder",
    params,
  });
}

// 委外生产工单-表身
export function qutsourcingProductionWorkOrdersub(params) {
  return request({
    url: "/qutsourcingProductionWorkOrdersub",
    params,
  });
}

// 委外订单-表头
export function outsourcingOrder(params) {
  return request({
    url: "/outsourcingOrder",
    params,
  });
}

// 委外订单-表身
export function outsourcingOrdersub(params) {
  return request({
    url: "/outsourcingOrdersub",
    params,
  });
}

//! 此接口是调用的手机报工初始化的界面，由于需要构建开工、完工信息，所以需要借用此接口创建信息
export function createKaiGongInfo() {
  return request({
    url: "/app/create",
  });
}

// 初始化委外工序内容：2个视图、2个表、3个触发器
export function outsourcInfo() {
  return request({
    url: "/outsourcInfo",
  });
}

// 查询需要委外工单
export function getSourseOrder(params) {
  return request({
    url: "/getSourseOrder",
    params,
  });
}

// 保存委外出库工单
export function saveOutSourse(data) {
  return request({
    url: "/saveOutSourse",
    data,
    method: "post",
  });
}

// 查询应收工单详情
export function getOutSouseOrder(params) {
  return request({
    url: "/getOutSouseOrder",
    params,
  });
}

// 保存委外出库工单
export function saveInSourse(data) {
  return request({
    url: "/saveInSourse",
    data,
    method: "post",
  });
}

/**
 * @description: 获取某一时间段中的人员产值情况
 * @param {*} params
 * @return {*}
 */
export function getPersonOutValue(params) {
  return request({
    url: "/getOutValue",
    params,
  });
}

/**
 * @description: 获取某一时间段中的机台产值情况
 * @param {*} params
 * @return {*}
 */
export function getMachineOutValue(params) {
  return request({
    url: "/machineOutValue",
    params,
  });
}
/**
 * @description: 获取某一时间段中的机台产值情况(根据开工时间计算   开工时间到完工时间 和开工时间到当前时间)
 * @param {*} params
 * @return {*}
 */
export function getMachineOutValue2(params) {
  return request({
    url: "/machineOutValue2",
    params,
  });
}
/* ------------------------------------------------------------------------------------------------------工序资料设定 */

/**
 * @description: 工序资料设定-获取工序资料
 * @return {*}
 */
export function prdWorkOrderSet(params) {
  return request({
    url: "/prdWorkorderset",
    params,
  });
}

/**
 * @description: 工序资料设定-更新工序资料
 * @param {*} data
 * @return {*}
 */
export function updateWorkOrderSet(data) {
  return request({
    url: "/prdWorkorderset",
    method: "patch",
    data,
  });
}

/**
 * @description: 工序资料设定-新增工序资料
 * @param {*} data
 * @return {*}
 */
export function addWorkOrderSet(data) {
  return request({
    url: "/prdWorkorderset",
    data,
    method: "post",
  });
}

/**
 * @description: 工序资料设定-删除工序资料
 * @param {*} data
 * @return {*}
 */
export function deleteWorkOrderSet(data) {
  return request({
    url: "/prdWorkorderset",
    data,
    method: "delete",
  });
}

/**
 * @description: 获取工序绑定的机台
 * @param {*} params
 */
export function getWorkOrderSetBindMachine(params) {
  return request({
    url: "/prdWorkorderset/bind/machine",
    params,
  });
}

/* ------------------------------------------------------------------------------------------------------不良品原因设定 */

/**
 * @description: 不良品原因设定-获取不良品原因
 * @param {*} params
 * @return {*}
 */
export function getPrdNotWellSet(params) {
  return request({
    url: "prdNotWellSet",
    params,
  });
}

/**
 * @description: 不良品原因设定-更新不良品原因
 * @param {*} data
 * @return {*}
 */
export function updatePrdNotWellSet(data) {
  return request({
    url: "/prdNotWellSet",
    data,
    method: "patch",
  });
}

/**
 * @description: 不良品原因设定-新增不良品原因
 * @param {*} data
 * @return {*}
 */
export function addPrdNotWellSet(data) {
  return request({
    url: "/prdNotWellSet",
    data,
    method: "post",
  });
}

/**
 * @description: 不良品原因设定-删除不良品原因
 * @param {*} data
 * @return {*}
 */
export function deletePrdNotWellSet(data) {
  return request({
    url: "/prdNotWellSet",
    data,
    method: "delete",
  });
}

/**
 * @description: 校验不良品编号是否重复
 * @param {*} data
 * @return {*}
 */
export function validatorNotWellID(data) {
  return request({
    url: "/validator_prdnotwellset",
    data,
    method: "post",
  });
}

// 委外订单明细表
export function outsourceSchedule(params) {
  return request({
    url: "/outsourceSchedule",
    params,
  });
}

// 人员生产报工表
export function ryscbgb(params) {
  return request({
    url: "/ryscbgb",
    params,
  });
}

// 产值明细表
export function czmxb(params) {
  return request({
    url: "/czmxb",
    params,
  });
}

// 宏茂生产报表
export function hmscbb(params) {
  return request({
    url: "/hmscbb",
    params,
  });
}

/**
 * @description: 检查当前的委外工序是否是最后一道工序
 * @param {*} data
 * @return {*}
 */
export function check_last_weiwai_order(data) {
  return request({
    url: "/check_last_weiwai_order",
    data,
    method: "post",
  });
}

/**
 * @description: 根据当前工序，获取上一道工序
 * @param {*} params
 * @return {*}
 */
export function last_order_desc(params) {
  return request({
    url: "/last_order_desc",
    params,
  });
}

/**
 * @description: 根据工单获取工艺路线中最后一道的顺序
 * @param {*} params
 * @return {*}
 */
export function estimate_order_ruku(params) {
  return request({
    url: "/estimate_order_ruku",
    params,
  });
}

/**
 * @description: 订单进度看板
 * @param {*} params
 * @return {*}
 */
export function getOrderProgressPannel(params) {
  return request({
    url: "/order/progress/pannel",
    params,
  });
}

/**
 * @description: 获取未领料的工单
 * @return
 */
export function getNoLingLiao_Orders(params) {
  return request({
    url: "/nolingliao_orders",
    params,
  });
}

/**
 * @description: 初始化领料表结构
 * @return
 */
export function lingliao_info(params) {
  return request({
    url: "/lingliao_info",
  });
}

/**
 * @description: 获取领料详情
 * @return
 */
export function lingliao_details(params) {
  return request({
    url: "/lingliao_details",
    params,
  });
}

/**
 * @description: 保存领料信息
 * @return
 */
export function wyb_save_lingliao(data) {
  return request({
    url: "/wyb_save_lingliao",
    method: "post",
    data,
  });
}

/**
 * @description: 领料、入库审核初始化
 * @param {*} data
 * @return
 */
export function lingliao_ruku_examine_info(data) {
  return request({
    url: "/lingliao_ruku_examine_info",
    data,
  });
}

/**
 * @description: 领料未审核的单据
 * @param {*} data
 * @return
 */
export function lingliao_list(params) {
  return request({
    url: "/lingliao_list",
    params,
  });
}

/**
 * @description: 领料未审核的单据
 * @param {*} data
 * @return
 */
export function wyb_lingliao_list(params) {
  return request({
    url: "/wyb_lingliao_list",
    params,
  });
}

/**
 * @description: 获取领料单据详情
 * @param {*} data
 * @return
 */
export function lingliao_list_datail(params) {
  return request({
    url: "/lingliao_list_detail",
    params,
  });
}

/**
 * @description: 获取领料单据详情
 * @param {*} data
 * @return
 */
export function wyb_lingliao_list_detail(params) {
  return request({
    url: "/wyb_lingliao_list_detail",
    params,
  });
}

/**
 * @description: 领料未审核单据-审核
 * @return
 */
export function lingliao_list_examine(data) {
  return request({
    url: "/lingliao_list_examine",
    data,
    method: "post",
  });
}

/**
 * @description: 获取厂内生产入库单清单
 * @param {*} data
 * @return
 */
export function wyb_ruku_list(params) {
  return request({
    url: "/wyb_ruku_list",
    params,
  });
}

/**
 * @description: 获取入库信息
 * @return
 */
export function wyb_ruku_order_detail(params) {
  return request({
    url: "/wyb_ruku_order_detail",
    params,
  });
}

/**
 * @description: 不良品仓库
 * @return
 */
export function wyb_blpck(params) {
  return request({
    url: "/wyb_blpck",
    params,
  });
}

/**
 * @description: 判断产品是否启用批号
 * @return
 */
export function wyb_cpsfqyph(params) {
  return request({
    url: "/wyb_cpsfqyph",
    params,
  });
}

/**
 * @description: 保存入库信息
 * @return
 */
export function wyb_save_ruku(data) {
  return request({
    url: "/wyb_save_ruku",
    method: "post",
    data,
  });
}

/**
 * @description: 入库未审核-清单
 * @return
 */
export function wyb_ruku_list_wsh(params) {
  return request({
    url: "/wyb_ruku_list_wsh",
    params,
  });
}

/**
 * @description: 入库未审核-清单
 * @return
 */
export function wyb_ruku_list_rkwsh(params) {
  return request({
    url: "/wyb_ruku_list_rkwsh",
    params,
  });
}

/**
 * @description: 入库未审核-明细
 * @return
 */
export function wyb_ruku_list_detail(params) {
  return request({
    url: "/wyb_ruku_list_detail",
    params,
  });
}

/**
 * @description: 入库未审核单据-审核
 * @return
 */
export function wyb_ruku_list_examine(data) {
  return request({
    url: "/wyb_ruku_list_examine",
    data,
    method: "post",
  });
}

/**
 * @description: 入库单更新
 * @return
 */
export function wyb_ruku_list_detait_update(data) {
  return request({
    url: "/wyb_ruku_list_detait_update",
    data,
    method: "post",
  });
}

export function getZaiZhiPanDian(params) {
  return request({
    url: "/zaizhi/pandian",
    params,
  });
}
